package com.stars.services.impl.pshow;

import com.github.pagehelper.PageInfo;
import com.stars.entity.dto.pshow.PShowOrdersDTO;
import com.stars.dao.mapper.pshow.PShowOrdersMapper;
import com.stars.entity.pshow.PShowOrdersEntity;
import com.stars.services.pshow.PShowOrdersAccessServices;
import com.stars.dao.mapper.pshow.PShowOrdersMapper;

import java.util.List;
import com.stars.entity.ListPage;
import com.github.pagehelper.PageHelper;
import com.stars.services.impl.BaseAccessServiceImpl;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @Title: 销售订单 业务逻辑
 * @author 肖伟
 * @date 2020-01-04
 * @version V1.0
 *
 */
@Service
public class PShowOrdersAccessServicesImpl  extends BaseAccessServiceImpl<PShowOrdersMapper , PShowOrdersEntity> implements  PShowOrdersAccessServices {
    @Autowired
    private PShowOrdersMapper  pShowOrdersMapper;


    /**
     * 分页查询
     * @param pageNum 查询参数 起始页，大小。
     * @return
     */
    @Override
    public PageInfo<PShowOrdersDTO> pageList(Integer pageNum, Integer pageSize, PShowOrdersDTO dto) throws Exception{
        ListPage<PShowOrdersDTO> listPage = new ListPage<>(pageNum, pageSize, dto);
        PageHelper.startPage(pageNum, pageSize);
        List<PShowOrdersDTO> list = pShowOrdersMapper.pageQueryPShowOrders(listPage);
        PageInfo<PShowOrdersDTO> pageInfo = new PageInfo<>(list);
        return pageInfo;
    }

    @Override
    public PShowOrdersDTO findDtoById(String id) {
        if (StringUtils.isBlank(id)) {
            return null;
        }
        return pShowOrdersMapper.selectDtoById(id);
    }

}
